﻿@model IEnumerable<blacksoft.Models.Venta>

@{
    ViewBag.Title = "Index";
}

@{
    Layout = "~/Views/Shared/_LayoutVentas.cshtml";
}

@if (TempData["create_success"] != null)
{
    <div class="success grid_12">
        <h3>Nuevo: @TempData["create_success"].</h3>
        <a class="hide_btn" href="#"></a>
    </div>
}
else if (TempData["edit_success"] != null)
{
    <div class="success grid_12">
        <h3>Modificar: @TempData["edit_success"].</h3>
        <a class="hide_btn" href="#"></a>
    </div>
}
else if (TempData["delete_success"] != null)
{
    <div class="success grid_12">
        <h3>Eliminar: @TempData["delete_success"].</h3>
        <a class="hide_btn" href="#"></a>
    </div>
}

@if (TempData["create_failure"] != null)
{
    <div class="error grid_12">
        <h3>Nuevo: @TempData["create_fail"].</h3>
        <a class="hide_btn" href="#"></a>
    </div>
}
else if (TempData["details_failure"] != null)
{
    <div class="error grid_12">
        <h3>Detalle: @TempData["create_fail"].</h3>
        <a class="hide_btn" href="#"></a>
    </div>
}
else if (TempData["edit_failure"] != null)
{
    <div class="error grid_12">
        <h3>Modificar: @TempData["edit_fail"].</h3>
        <a class="hide_btn" href="#"></a>
    </div>
}
else if (TempData["delete_failure"] != null)
{
    <div class="error grid_12">
        <h3>Eliminar: @TempData["delete_fail"].</h3>
        <a class="hide_btn" href="#"></a>
    </div>
}

<div class="block big">
    <div class="titlebar">
        <h3>Generar Venta</h3>
    </div>
    <div class="block_cont">
        <a href="/Venta/Create" class="navbutton">
            <span class="icon_plus">
                Nueva Venta
            </span>
        </a>

        @using (Html.BeginForm("Index", "Venta", FormMethod.Get))
        {
            <p class="form">
                Fecha de Pago: @Html.TextBox("search_fechpago", null, new { @class = "text-box single-line", @type = "date" })
                Código de la Reserva Asociada:@Html.TextBox("search_codres", null, new { @class = "text-box single-line" })
                <input type="submit" class="btn btn-default" value="Filtrar" style="margin-top: 10px;" />
            </p>
        }


        <table class="data-table">
            <thead>
                <tr>
                    <th>
                        @Html.DisplayNameFor(model => model.FechaPago)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.IDNotaCredito)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.MedioPago)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.Subtotal)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.IGV)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.Total)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.Estado)
                    </th>
                    <th>
                        Acciones
                    </th>
                </tr>
            </thead>

            @foreach (var item in Model)
            {
                <tr>
                    <td>
                        @Html.DisplayFor(modelItem => item.FechaPago)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.IDNotaCredito)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.MedioPago)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Subtotal)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.IGV)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Total)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Estado)
                    </td>
                    <td>
                        <div style="height: 3px;"></div>
                        <div class="actionbar">
                            <a href=@string.Concat("/Venta/Details/", item.IDVenta) class="action view"><span>Detalles</span></a>
                            @*<a href=@string.Concat("/Venta/Edit/", item.IDVenta) class="action edit"><span>Modificar</span></a>
                            <a href=@string.Concat("/Venta/Delete/", item.IDVenta) class="action delete"><span>Eliminar</span></a>*@
                        </div>
                    </td>
                </tr>
            }

        </table>
    </div>

</div>
